<template>
    <div class="json-preview">
        <vue-json-pretty
            :data="data"
            :deep="deep"
            :selectable="true"
            :show-double-quotes="false"
            :show-length="false"
            theme="light" />
    </div>
</template>

<script lang="ts">
// https://github.com/leezng/vue-json-pretty/blob/dev/README.zh_CN.md
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
import {Component, Prop, Vue} from 'vue-property-decorator';

@Component({
    components: {
        VueJsonPretty
    }
})
export default class JsonPreview extends Vue {
    @Prop({ required: true }) data: any;
    @Prop({required: false, default: Infinity}) deep: number;
}

</script>

<style lang="scss" scoped>
.json-preview {
  width: 100%;
}
</style>
